import { GET, POST } from "./xhr";

/**
 * 创建所有数据库
 */

// 请求所有字典标签
export const fetchAllDictionary = async () => await GET("/api/dictionary/all");

// 新增字典标签
export const fetchAddDictLabel = async (data: any) =>
  await POST("/api/dictionary/addlabel", data);

// 请求所有字典标签
export const fetchAllDictLabel = async () =>
  await GET("/api/dictionary/alllabel");

// 删除字典标签
export const fetchDelDictLabel = async (data: any) =>
  await POST("/api/dictionary/dellabel", data);

// 更新字典标签
export const fetchUpdateDictLabel = async (data: any) =>
  await POST("/api/dictionary/updatelabel", data);

// 新增字典的值
export const fetchAddDictValue = async (data: any) =>
  await POST("/api/dictionary/addvalue", data);

// 根据标签id请求所有值
export const fetchGetDictValueById = async (data: any) =>
  await POST("/api/dictionary/values", data);

// 删除字典标签的值
export const fetchDelValueById = async (data: any) =>
  await POST("/api/dictionary/delvalue", data);

// 更新字典的值
export const fetchUpdateDictValue = async (data: any) =>
  await POST("/api/dictionary/updatevalue", data);

// 获取字典的label和值
export const fetchFullDict = async () => await GET("/api/dictionary/fulldict");
